package Simulator;

import java.util.Date;

/**
 * Object representing an MDT log entry.
 */

public class LogEntry {

	public static int RECEIVED = 1;
	public static int SENT = 2;

	private final String message;
	private final int type;
	private final Date date;

	/**
	 * Creates a LogEntry with message "message" and type "type" (received
	 * message or sent message)
	 * 
	 * @param message
	 *            the message to log
	 * @param type
	 *            equal to LogEntry.RECEIVED or LogEntry.SENT
	 */
	public LogEntry(String message, int type) {
		this.message = message;
		this.type = type;
		this.date = new Date();
	}

	/**
	 * 
	 * @return the log's entry message
	 */
	public String getMessage() {
		return this.message;
	}

	/**
	 * 
	 * @return true if the type is equal to LogEntry.RECEIVED, false otherwise
	 */
	public boolean isAReceivedMessage() {
		return this.type == RECEIVED;
	}

	/**
	 * 
	 * @return true if the type is equal to LogEntry.SENT, false otherwise
	 */
	public boolean isASentMessage() {
		return this.type == SENT;
	}

	/**
	 * 
	 * @return the time at wich the log entry was created
	 */
	public Date getDate() {
		return this.date;
	}

}
